{ pkgs, ... }:
{
  # Enable CUPS to print documents.
  services = {
    printing = {
      enable = true;
      drivers = with pkgs; [
        gutenprint
        gutenprintBin
        hplip hplipWithPlugin
      ];

      browsing = true;
      browsedConf = ''
      	BrowseDNSSDSubTypes _cups,_print
				BrowseLocalProtocols all
				BrowseRemoteProtocols all
				CreateIPPPrinterQueues All
				
				BrowseProtocols all
      '';
      
      listenAddresses = [ "*:631" ];
      allowFrom = [ "all" ];
      defaultShared = true;
    };

    avahi =
      {
        enable = true;
        nssmdns = true;
        openFirewall = true;

        publish = {
          enable = true;
          userServices = true;
        };
      };
  };

  networking.firewall = {
    enable = true;
    allowedUDPPorts = [ 631 ];
    allowedTCPPorts = [ 631 ];
  };

  environment.systemPackages = with pkgs; [
    unstable.cups-pdf-to-pdf
    cups-filters
  ];
}
